[Monitoring] Ensure the settings api always return the xpack/default_admin_email#22220
Conversation
…ill returns a null value for default_admin_email
💚 Build Succeeded |
|
@chrisronline Conflicts! |
|
The functionality of the API as described in the test steps is good. However, with this change, the API will return a slightly different response than what the internal monitoring code in Kibana would ship to Monitoring. I believe the latter would never ship a document to Monitoring if the value of the email address is I wonder if we can get rid of the |
💚 Build Succeeded |
| default_admin_email: email | ||
| } | ||
| }; | ||
| } |
There was a problem hiding this comment.
Since the collector constructor spreads in any property given to it, we can make this function a part of the settings collector instance.
something like:
collectorSet.makeStatsCollector({
type: ...,
async fetch: ...,
getEmailValueStructure: email => ({
xpack: { default_admin_email: email }
})
})
In the line below where getEmailValueStructure is used in the fetch, it can use this.getEmailValueStructure(defaultAdminEmail)
| import { wrap as wrapError } from 'boom'; | ||
| import { KIBANA_SETTINGS_TYPE } from '../../../../../monitoring/common/constants'; | ||
| import { getKibanaInfoForStats } from '../../../../../monitoring/server/kibana_monitoring/lib'; | ||
| import { getEmailValueStructure } from '../../../../../monitoring/server/kibana_monitoring/collectors/get_settings_collector'; |
There was a problem hiding this comment.
we should be able to not have this import when getEmailValueStructure is a method of settingsCollector
tsullivan
left a comment
There was a problem hiding this comment.
A suggestion to make the new function more handy, and not need the new import
|
@tsullivan Great suggestions! Updated now! |
💔 Build Failed |
|
Jenkins, test this |
💚 Build Succeeded |
tsullivan
left a comment
There was a problem hiding this comment.
LGTM
I pulled down the branch and tested the API; refreshing a few times to ensure the same object is returned each time
…admin_email (elastic#22220) * If the settings collector returns nothing, ensure the settings api still returns a null value for default_admin_email * Update test * Feedback from PR
|
Backport: 6.x: 4fe840e |
Fixes #22107
This PR ensures that even if the kibana settings collector returns nothing, we still return an identical structure in the api response as if the kibana settings collector did return something.
To test:
/api/settingsendpointxpack: { default_admin_email: null }section./api/settingsendpoint